#!/bin/sh

NSEC3=`cleandig test.dyndns NSEC3PARAM hidesoadetails dnssec`
echo $NSEC3
HAVENSEC3=`echo $NSEC3 | egrep 'IN[[:space:]]NSEC3PARAM' | wc -l`

cleandig c.host.test.dyndns A hidesoadetails dnssec

cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update add test.dyndns. 3600 NSEC3PARAM 1 $optout 10 DCBE
update add b.host.test.dyndns. 3600 A 127.0.0.1
send
answer
!

cleandig test.dyndns NSEC3PARAM hidesoadetails dnssec
cleandig c.host.test.dyndns A hidesoadetails dnssec

cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update DELETE test.dyndns. NSEC3PARAM
update DELETE b.host.test.dyndns. 3600 A 127.0.0.1
send
answer
!

cleandig test.dyndns NSEC3PARAM hidesoadetails dnssec
cleandig c.host.test.dyndns A hidesoadetails dnssec

if [ $HAVENSEC3 != 0 ]
then
	cleannsupdate <<!
	server $nameserver $port
	zone test.dyndns
	update add test.dyndns. 3600 NSEC3PARAM 1 $optout 1 abcd
	send
	answer
!

	cleandig test.dyndns NSEC3PARAM hidesoadetails dnssec
	cleandig c.host.test.dyndns A hidesoadetails dnssec
fi
